/** * @license * Copyright 2017 JBoss Inc * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import { ChangeDetectorRef, EventEmitter } from "@angular/core"; import { Node, NodePath, Oas20ResponseDefinition, Oas20SchemaDefinition, Oas30ResponseDefinition, Oas30SchemaDefinition, OasDocument, OasPathItem } from "apicurio-data-models"; import { AddPathDialogComponent } from "./dialogs/add-path.component"; import { ClonePathDialogComponent } from "./dialogs/clone-path.component"; import { CloneDefinitionDialogComponent } from "./dialogs/clone-definition.component"; import { SelectionService } from "../_services/selection.service"; import { CommandService } from "../_services/command.service"; import { EditorsService } from "../_services/editors.service"; import { DataTypeData } from "./editors/data-type-editor.component"; import { RestResourceService } from "../_services/rest-resource.service"; import { RenamePathDialogComponent } from "./dialogs/rename-path.component"; import { AbstractBaseComponent } from "./common/base-component"; import { DocumentService } from "../_services/document.service"; import { RenameEntityDialogComponent, RenameEntityEvent } from "./dialogs/rename-entity.component"; import { ResponseData } from "./editors/response-editor.component"; import { CloneResponseDefinitionDialogComponent } from "./dialogs/clone-response-definition.component"; import { FeaturesService } from "../_services/features.service"; import { ComponentType } from "../_models/component-type.model"; /** * The component that models the master view of the API editor. This is the * left-hand side of the editor, which lists things like Paths and Definitions. * Users will select an item in this master panel which will result in a form * being displayed in the detail panel. */ export declare class EditorMasterComponent extends AbstractBaseComponent { private commandService; private editors; private restResourceService; private features; document: OasDocument; onImportComponent: EventEmitter; contextMenuSelection: NodePath; contextMenuType: string; contextMenuPos: any; addPathDialog: AddPathDialogComponent; clonePathDialog: ClonePathDialogComponent; renamePathDialog: RenamePathDialogComponent; cloneDefinitionDialog: CloneDefinitionDialogComponent; renameDefinitionDialog: RenameEntityDialogComponent; cloneResponseDialog: CloneResponseDefinitionDialogComponent; renameResponseDialog: RenameEntityDialogComponent; filterCriteria: string; _paths: OasPathItem[]; _defs: (Oas20SchemaDefinition | Oas30SchemaDefinition)[]; _responses: (Oas20ResponseDefinition | Oas30ResponseDefinition)[]; /** * C'tor. * @param changeDetectorRef * @param documentService * @param selectionService * @param commandService * @param editors * @param restResourceService * @param features */ constructor(changeDetectorRef: ChangeDetectorRef, documentService: DocumentService, selectionService: SelectionService, commandService: CommandService, editors: EditorsService, restResourceService: RestResourceService, features: FeaturesService); ngOnInit(): void; protected onDocumentChange(): void; onPathsKeypress(event: KeyboardEvent): void; onDefinitionsKeypress(event: KeyboardEvent): void; onResponsesKeypress(event: KeyboardEvent): void; protected handleArrowKeypress(event: KeyboardEvent, items: Node[]): void; /** * Returns an array of paths that match the filter criteria and are sorted alphabetically. */ paths(): OasPathItem[]; /** * Returns the array of definitions, filtered by search criteria and sorted. */ definitions(): (Oas20SchemaDefinition | Oas30SchemaDefinition)[]; definitionsPath(): string; /** * Returns an array of responses filtered by the search criteria and sorted. */ responses(): (Oas20ResponseDefinition | Oas30ResponseDefinition)[]; responsesPath(): string; /** * Returns true if the given item is a valid path in the current document. * @param pathItem */ protected isValidPathItem(pathItem: OasPathItem): boolean; /** * Returns true if the given schema definition is valid and contained within the * current document. * @param definition * @return */ protected isValidDefinition(definition: Oas20SchemaDefinition | Oas30SchemaDefinition): boolean; /** * Returns true if the given response is valid and contained within the * current document. * @param response * @return */ protected isValidResponse(response: Oas20ResponseDefinition | Oas30ResponseDefinition): boolean; /** * Called when the user selects the main/default element from the master area. */ selectMain(): void; /** * Called when the user selects a path from the master area. * @param path */ selectPath(path: OasPathItem): void; /** * Called to deselect the currently selected path. */ deselectPath(): void; /** * Called when the user selects a definition from the master area. * @param def */ selectDefinition(def: Oas20SchemaDefinition | Oas30SchemaDefinition): void; /** * Deselects the currently selected definition. */ deselectDefinition(): void; /** * Called when the user selects a response from the master area. * @param response */ selectResponse(response: Oas20ResponseDefinition | Oas30ResponseDefinition): void; /** * Deselects the currently selected response. */ deselectResponse(): void; /** * Called whenever the user presses a key. * @param event */ onGlobalKeyDown(event: KeyboardEvent): void; /** * Called to return the currently selected path (if one is selected). If not, returns "/". */ getCurrentPathSelection(): string; /** * Called when the user fills out the Add Path modal dialog and clicks Add. * @param path */ addPath(path: string): void; /** * Returns true if the given node is the currently selected item *or* is the parent * of the currently selected item. * @param node * @return */ isSelected(node: Node): boolean; /** * Returns true if the main node should be selected. * @return */ isMainSelected(): boolean; /** * Returns true if the given node is the current context menu item. * @param node * @return */ isContexted(node: Node): boolean; /** * Called when the user fills out the Add Definition modal dialog and clicks Add. */ addDefinition(data: DataTypeData): void; /** * Called when the user fills out the Add Response editor and clicks Add. */ addResponse(data: ResponseData): void; /** * Converts a JSON formatted string example to an object. * @param from */ protected exampleAsObject(from: string): any; /** * Gets a definition by its name. * @param name */ protected getDefinitionByName(name: string): Oas20SchemaDefinition | Oas30SchemaDefinition; /** * Gets a response by its name. * @param name */ protected getResponseByName(name: string): Oas20ResponseDefinition | Oas30ResponseDefinition; /** * Called when the user searches in the master area. * @param criteria */ filterAll(criteria: string): void; /** * Called when the user right-clicks on a path. * @param event * @param pathItem */ showPathContextMenu(event: MouseEvent, pathItem: OasPathItem): void; /** * Called when the user clicks somewhere in the document. Used to close the context * menu if it is open. */ onDocumentClick(event: MouseEvent): void; /** * Closes the context menu. */ private closeContextMenu; /** * Called when the user clicks "New Path" in the context-menu for a path. */ newPath(): void; /** * Called when the user clicks "Delete Path" in the context-menu for a path. */ deletePath(): void; /** * Called when the user clicks "Clone Path" in the context-menu for a path item. */ clonePath(modalData?: any): void; /** * Called when the user right-clicks on a data type. * @param event * @param definition */ showDefinitionContextMenu(event: MouseEvent, definition: Oas20SchemaDefinition | Oas30SchemaDefinition): void; /** * Called when the user right-clicks on a response. * @param event * @param definition */ showResponseContextMenu(event: MouseEvent, definition: Oas20ResponseDefinition | Oas30ResponseDefinition): void; /** * Called when the user clicks the "Delete Definition" item in the context-menu for a definition. */ deleteDefinition(): void; /** * Called when the user clicks the "Delete Response" item in the context-menu for a response. */ deleteResponse(): void; /** * Called when the user clicks "Clone Definition" in the context-menu for a definition. */ cloneDefinition(modalData?: any): void; /** * Called when the user clicks "Clone Response" in the context-menu for a response. */ cloneResponse(modalData?: any): void; /** * Called when the user clicks "Rename Definition" in the context-menu for a schema definition. */ renameDefinition(event?: RenameEntityEvent): void; /** * Called when the user clicks "Rename Response" in the context-menu for a response. */ renameResponse(event?: RenameEntityEvent): void; /** * Figures out the definition name. * @param schemaDef */ protected definitionName(schemaDef: Oas20SchemaDefinition | Oas30SchemaDefinition): string; /** * Called when the user clicks "Rename Definition" in the context-menu for a schema definition. */ renamePath(modalData?: any): void; /** * Called to determine whether there is a validation problem associated with the given * node (either directly on the node or any descendant node). * @param node */ hasValidationProblem(node: Node): boolean; entityClasses(node: Node): string; /** * Returns the classes that should be applied to the path item in the master view. * @param node * @return */ pathClasses(node: OasPathItem): string; /** * Returns the classes that should be applied to the schema definition in the master view. * @param node * @return */ definitionClasses(node: Node): string; /** * Returns the classes that should be applied to the response definition in the master view. * @param node * @return */ responseClasses(node: Node): string; /** * Opens the Add Definition Editor (full screen editor for adding a data type). */ openAddDefinitionEditor(): void; /** * Opens the Add Response Editor (full screen editor for adding a response). */ openAddResponseEditor(): void; /** * Gets the node path for the given data model node. * @param node */ asNodePath(node: Node): string; shouldShowValidationAggregate(): boolean; importsEnabled(): boolean; importDataTypes(): void; importResponses(): void; }